<template>
	<view class="mainpadding" v-if="pageShow">
		<view class="sanshier bold xiaohei">{{dataAll.name}}</view>
		<view class="flexbetween">
			<view class="main_size margin_top xiaohui">{{httpRequest.timereturn(dataAll.createtime*1000)}}</view>
			<template v-if="dataAll.type==1">
				<u-icon name="star" color="#999" size="28" v-if="dataAll.is_collect==0" @click="scFn()"></u-icon>
				<u-icon name="star-fill" color="#ffa126" size="28" v-if="dataAll.is_collect==1" @click="scFn()"></u-icon>
			</template>
		</view>
		<view class=" margin_top">
			<u-parse :content="dataAll.content"></u-parse>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid:"",
				dataAll:{},
				httpRequest,
				pageShow:false
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.getdetail()
		},
		methods: {
			scFn(){
				httpRequest.request('/api/user/clNoticeCollect','GET',{
					notice_id:this.listid
				}).then(res => {
					httpRequest.toast(res.msg)
					if(res.code==1){
						this.dataAll.is_collect = this.dataAll.is_collect?0:1
					}
				})
			},
			getdetail(){
				httpRequest.request('/api/index/noticeDetail','GET',{
					id:this.listid
				}).then(res => {
					uni.setNavigationBarTitle({
						title:res.data.name
					})
					this.dataAll = res.data
					this.pageShow = true
				})
			}
		}
	}
</script>

<style>

</style>
